#include <functional>
#include <iostream>

void example_function(int a, double b, const std::string& c) {
    std::cout << "example_function called with values: "
              << a << ", " << b << ", " << c << std::endl;
}
//g++ UsingBindBack.cpp --std=c++23 -o UsingBindBack
int main() {
#if __cpp_lib_bind_back >= 202202L
    auto bound_function = std::bind_back(example_function, "Hello World");
    std::cout << "std::bind_back is available." << std::endl;
#else
    auto bound_function = std::bind(example_function, std::placeholders::_1, std::placeholders::_2, "Hello World");
    std::cout << "std::bind_back is not available." << std::endl;
#endif

    bound_function(42, 3.14159); // 等效于调用 example_function(42, 3.14159, "Hello World")
    
    return 0;
}